const { exec_shell } = require("../utils/shell_tool");
const { BaseCommand } = require("./base");

class SvnUpdateCommand extends BaseCommand {
    async execute() {
        const data = this.selfData;
        if (data.credential) {
            return await exec_shell({
                cmd: `svn update --username ${data.credential.username} --password ${data.credential.password}`,
                cwd: data.cwd,
                encoding: data.encoding,
                capture_stdout: data.capture_stdout,
            });
        } else {
            return await exec_shell({
                cmd: "svn update",
                cwd: data.cwd,
                encoding: data.encoding,
                capture_stdout: data.capture_stdout,
            });
        }
    }
}

module.exports = {
    SvnUpdateCommand,
};
